package com.wyix.service.impl;

import com.wyix.service.MemberService;

/**
 * @author wangdx
 * @since 2025/8/6
 */
// 会员服务接口实现类（JDK代理需要接口）
public class MemberServiceImpl implements MemberService {
    @Override
    public String addPoints(String userId, int points) {
        if (points <= 0) throw new IllegalArgumentException("积分必须为正数");
        System.out.println("为用户【" + userId + "】增加积分：" + points);
        return "积分增加成功，当前总积分：100 + " + points;  // 模拟总积分
    }

    @Override
    public String exchangeCoupon(String userId) {
        System.out.println("用户【" + userId + "】兑换优惠券");
        return "5元无门槛优惠券已发放";
    }
}
